package com.zxt.dental_sys.Controller.Other;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zxt.dental_sys.model.CaseInfo;
import com.zxt.dental_sys.model.ConsultInfo;
import com.zxt.dental_sys.model.EnvironmentalFeedbackInfo;
import com.zxt.dental_sys.model.SysElementUserinfo;
import com.zxt.dental_sys.model.vo.RestBean;
import com.zxt.dental_sys.service.SysElementUserinfoService;
import com.zxt.dental_sys.service.impl.CaseInfoServiceImpl;
import com.zxt.dental_sys.service.impl.ConsultInfoServiceImpl;
import com.zxt.dental_sys.service.impl.EnvironmentalFeedbackInfoServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/other")
public class OtherController {

    @Resource
    SysElementUserinfoService userinfoService;

    @Resource
    CaseInfoServiceImpl caseInfoService;

    @Resource
    EnvironmentalFeedbackInfoServiceImpl environmentalFeedbackInfoService;

    @Resource//在线咨询
    ConsultInfoServiceImpl consultInfoService;

    @RequestMapping("/info")
    public RestBean info(){
        List<Long> list=new ArrayList<>();
        long userInfos = userinfoService.count(new QueryWrapper<SysElementUserinfo>()
                .eq("is_deleted", 0)
        );
        long caseCount = caseInfoService.count(new QueryWrapper<CaseInfo>()
                .eq("is_deleted", 0)
        );
        long environmentalCount = environmentalFeedbackInfoService.count(new QueryWrapper<EnvironmentalFeedbackInfo>()
                .eq("is_deleted", 0)
        );
        long consultCount = consultInfoService.count(new QueryWrapper<ConsultInfo>()
                .eq("is_deleted", 0)
        );
        list.add(userInfos);
        list.add(caseCount);
        list.add(environmentalCount);
        list.add(consultCount);
        return RestBean.success(list);
    }

}
